home *** CD-ROM | disk | FTP | other *** search
Makefile | 1994-08-02 | 15.5 KB | 502 lines |
- #
- # $Id: Makefile,v 0.91 1994/02/20 00:07:45 zhao Pre-Release $
- #
- # *. This file is part of BIT shareware package. After the two weeks of
- # * free evaluation period, you are encouraged (required) to register
- # * your copy for a small registration fee, which is $35 for personal use
- # * and $50 for commercial, government and institutional use.
- # *
- # * Copyright(c) 1993, 1994 by T.C. Zhao.
- # * All rights reserved.
- # *
- # * Permission to use, copy, and distribute this software in its entirety
- # * for non-commercial purposes is hereby granted, provided that the
- # * above shareware and copyright notices and this permission notice
- # * appear in all copies and their documentation.
- # *
- # * This software may be modified for your own use, but modified versions
- # * may not be distributed without prior consent of the author.
- # *
- # * This software is provided "as is" without expressed or implied
- # * warranty of any kind.
- # *
- # *.
- #
- # Makefile for BIT
- #
- # Usage: make [all] [clean] [veryclean] [install] [man] [sfmt]
- #
- # all - the default. generate executables, but do not install them
- # install - all + copy all files to their respective directories
- # uninstall - remove installed bit package
- # clean - remove all object files and other stuff from this directory
- # veryclean - clean + removing all libraries
- # man - generate online man page for bit. Resulting file is bit.m.
- # (tbl bit.1 | nroff -man)
- # sfmt - format all routines to a standard style so we can safely
- # apply diffs. The style itself is not important, as
- # you can format the source whatever way you like when you
- # are editing it. Use GNU indent(1.6 or later) with
- # -fca -nfc1 -cdb -sc -i4 -npcs -ss options
- #
-
- VERSION=0.91
-
- #------------------------------------------------
- # where your final executables will go
- #------------------------------------------------
- BIN = /usr/local/bin
-
- #------------------------------------------------
- # How to get there from here
- #------------------------------------------------
- INSTALL = cp
-
- #------------------------------------------------
- # where to put online helps, and icons, (note no quotes).
- # Basically all stuffs that won't change. Enviorment variable
- # by the same name overrides this setting
- #------------------------------------------------
- BITHELP = /usr/local/lib/bit
-
- #-------------------------------------------------
- # where to find configuration, external filters and other stuff
- # modifiable by user.
- # Default is ~/.bitrc (expanded at run time)
- #
- # Enviorment variable by the same name overrides this setting
- #-------------------------------------------------
- BITDIR = $$HOME/.bitrc
-
- #---------------------------------------------------
- # Where to put man pages
- # To be processed by tbl bit.1 | {nt}roff -man
- # PS version of the manual, bit.ps, is in ../docs directory
- # and generated by tbl bit.1 | ptroff -t -man
- #---------------------------------------------------
-
- MANDIR = /usr/local/man/man1
-
- #---------------------------------------------------------------
- # Where to put temporary files. Default /usr/tmp.
- # The prefered method is to use enviorment variable of the same name
- # to override the default
- #-----------------------------------------------------------------
- #TMPDIR=/usr/tmp
-
- #-----------------------------------------------------------------
- # CPP defines and their meanings:
- # Use the default or leave all of them undefined is STRONGLY recommanded.
- #
- # NO_TIMING -- Disable showing timing for loading, writing etc, not
- # terribly accurate. Mostly for me to timing new algorithms.
- # MAIL_AUTHOR -- Define this flag if you want bit to send me a brief
- # message when it detects core dumps or other critical errors.
- # F_ID -- Every routine has its own version number compiled in.
- # main program will always has its id compiled in
- # MDEBUG -- Debug code will be compiled in. (for me only)
- # MTRACE -- Trace code will be compiled in. (don't do this)
- # Note that MTRACE includes MDEBUG.
- #
- # M_DBG -- Check memeory leaks with a naive method (for me)
- # CORE -- If something is wrong, want to have core
- #
- # TIGHT_MEM See following
- # MAXMEMK See following
- #
- # For various reasons, BIT sometimes keeps two copies of the image in core.
- # If memory is tight (say main memory is less than 16 Mbytes or the images
- # in question are large), define TIGHT_MEM and then whenver the memory
- # would've been used by the extra copy is larger than MAXMEMK, the extra
- # copy will not be made. Obviousely, MAXMEMK has meaning only if TIGHT_MEM
- # is defined. The default value for MAXMEMK is about 3Mbytes.
- #
- # NOTE: Mixed defines, i.e., some files are compiled with a particular
- # flag defined and others compiled with that flag undefined,
- # can lead to funny things (program does not work, not very funny
- # actuallly). If for whatever reason, a flag is changed,
- # do a make clean before re-make
- #
- # There is a bug in the fontmanager (IRIX4.0.5 only ?) that prevents
- # bit from releasing memory used by various fonts, and that could eat
- # a lot of memory quickly. If you are not running 4.0.5, you might want
- # to define NO_FM_BUG. Also try to view string.ppm and move the windows
- # around a few times to see if it core dumps. If it does, you have this
- # bug, remove -DNO_FM_BUG and text.o and re-make
- #
-
- DEFINES=
-
- #--------------------------------------------------------------
- # FORMATS
- # Define a flag to remove a particular format
- # e.g, NO_GIF NO_TIFF etc.
- # Note that you can not remove IRIS RGB and scratch files
- #
- # Currently TIFF is supported thru pnmtotiff/tifftopnm and/or
- # fromtiff/totiff, so if you do not have any of these, added
- # -DNO_TIFF to the RMFORMAT flag
- #
- #RMFORMAT=-DNO_TIFF
- #
-
- #---------------------------------------------------------------
- # basic stuff: compiler.
- #
-
- CC = cc
-
- #---------------------------------------------------------------
- # flags to CC (not counting defines).
- #
-
- CCFLAGS=-O
-
- #CCFLAGS = -ansi -pedantic -Wall -O -Wshadow -Wmissing-prototypes\
- # -Wstrict-prototypes -Waggregate-return
- #
- #---------------------------------------------------------------
- # Loader flags
- #
-
- LDFLAGS=-O
-
- #----------------------------------------------------------------
- # System libraries. It is important to use shared library
- # as it reduces the final exe file size greatly
- #
- # -limage is for support of IRIS RGB files. On IRIX 3.3, it is
- # in the standard directories. Also, image.h is included
- # in iris.c as <gl/image.h>
- # -lmalloc is allegedly faster.
- #
- # If using gcc, need to uncomment the following when linking.
- #
- #XL=-lX11_s -lXext
- #
- SYSLIB = -limage -lfm_s -lgl_s $(XL) -lm -lmalloc -lc_s
-
- #**********************************************************************
- # END OF confiurable flags. Better not to change anything after this
- #***********************************************************************
-
- HELPMODE = 644
- EXEMODE = 711
- SHELL = /bin/sh
-
- # flags to cc: pure cc flag + cpp flags
- CFLAGS=$(DEFINES) $(RMFORMAT) $(CCFLAGS) -Iulib -Iforms/FORMS
-
- # define where the FORMS library is
- #
- # The FORMS library used is based on Version 2.2. Note that this version
- # is slightly different from standard Version 2.2 and hence you
- # can NOT use the standard version even if you have it. Sorry about
- # this. See READ_BIT in forms directory for details
- #
- GUI_LIB=-Lforms/FORMS -lforms
- LGUI=libforms.a
-
- # where JPEG libraries.
- #
- # VERSION 4.
- #
- JPG_LIB=-Ljpeg -ljpeg
- LJPG=libjpeg.a
-
- #
- # MPEG library
- #
- MPEG_LIB=-Lmpeg -lmpeg
- LMPG=libmpeg.a
-
- #utilities
- UTIL_LIB=-Lulib -lutil
- LUTIL=libutil.a
-
- USERLIB =$(GUI_LIB) $(JPG_LIB) $(MPEG_LIB) $(UTIL_LIB)
- LIBS=$(USERLIB) $(SYSLIB)
-
-
- # routines still under testing
- TTT= measure.o paint.o browse.o cursors.o medianf.o #hspec.o
-
- # The formats files
- FORMATS=iris.o pnm.o jpeg.o gif.o scratch.o ps.o holo.o xbm.o\
- sunrast.o mpeg.o
-
- OBJ=$(FORMATS) flist.o display.o init.o gl_util.o repaint.o \
- fio.o crop.o text.o cut.o quant.o dither.o iutil.o iopen.o\
- gui.o mdbg.o getmat.o smooth.o tran2d.o marking.o extbind.o\
- iprocess.o control.o coledit.o zoom.o pedit.o events.o\
- merge.o $(TTT)
-
- OBJS=main.o $(OBJ)
-
- CSRC=$(OBJS:.o=.c) clock_mail.c
- HDR=bit.h global.h extern.h dmalloc.h utype.h proto.h gluproto.h gui.h\
- uproto.h tsdef.h bm.h curdef.h paint.h
-
- # all files that contain copyright notices
- CPSRC=$(CSRC) $(HDR) mac.h lookup.h symbol.h Makefile
-
- SRC=$(CSRC) $(HDR) mac.h lookup.h symbol.h\
- Makefile copyright 01Readme bit.1 README ChangeLog
-
- BIT = bit
- CLOCK_MAIL = iclock_mail
- MPEG = sgimpeg
-
- EXE= $(BIT) $(CLOCK_MAIL)
-
- all: $(EXE) $(MPEG)
-
- #**************************************************************
- # make install will do the following
- #**************************************************************
- install: all installexe installhelp installman installmisc
-
- installexe: $(EXE) $(MPEG)
- -strip $(EXE) mpeg/$(MPEG)
- -$(INSTALL) $(EXE) mpeg/$(MPEG) $(BIN)
- -@for i in $(EXE) $(MPEG); do chmod $(EXEMODE) $(BIN)/$$i;done
- -@date > $@
-
- # all help file, data file, icons
- ALLHF=../help/*hlp ../help/*map ../help/*icon ../help/BIT* ../help/*dat\
- ../help/01Readme ../Registration
-
- installhelp: $(ALLHF)
- -@if [ ! -d $(BITHELP) ];then mkdir $(BITHELP); fi
- @$(INSTALL) $? $(BITHELP)
- -@chmod $(HELPMODE) $(BITHELP)/*
- -@date > $@
-
- # the man page
- installman: bit.1
- -@if [ ! -d $(MANDIR) ];then mkdir $(MANDIR); fi
- -$(INSTALL) $? $(MANDIR)
- -chmod $(HELPMODE) $(MANDIR)/$?
- -@date > $@
-
- # other stuff
- #../help/*opt
- installmisc: ../help/BIT*
- -@if [ ! -d $(BITDIR) ];then mkdir $(BITDIR); fi
- $(INSTALL) $? $(BITDIR)
- -@chmod $(HELPMODE) $(BITDIR)/*
- -@date > $@
-
- #*****************************************************************
- # make uninstall
- #****************************************************************
- UNINSTALL= /bin/rm -r
- uninstall: uninstallexe uninstallmisc uninstallman uninstallhelp
-
- uninstallexe:; -(cd $(BIN); $(UNINSTALL) $(EXE) ); /bin/rm -f installexe
- uninstallhelp:; -$(UNINSTALL) $(BITHELP); /bin/rm -f installhelp
- uninstallmisc:; -$(UNINSTALL) $(BITDIR); /bin/rm -f installmisc
- uninstallman:; -$(UNINSTALL) $(MANDIR)/bit.1; /bin/rm -f installman
-
- #***************************************************************
- # make clean
- #****************************************************************
-
- clean:;-/bin/rm -f core a.out installhelp installman installmisc \
- installexe update $(EXE) tags *.o *.ln *log \
- xx* *~ *.bak *.orig
-
- veryclean: clean
- -/bin/rm -f new
- (cd forms/FORMS; make empty)
- (cd jpeg; make clean)
- (cd mpeg; make clean)
- (cd ulib; make veryclean)
-
-
- $(BIT): $(LJPG) $(LMPG) $(LGUI) $(LUTIL) $(OBJS);
- $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
-
- $(CLOCK_MAIL):clock_mail.o; $(CC) $(LDFLAGS) -o $@ clock_mail.o $(LIBS)
- $(MPEG):; (cd mpeg; make $@)
-
- $(LJPG): ; (cd jpeg; make CC=$(CC) CFLAGS="$(CCFLAGS)" libjpeg.a)
- $(LUTIL): ; (cd ulib; make CC=$(CC) CFLAGS="$(CCFLAGS)" )
- $(LGUI): ;(cd forms/FORMS; make CC=$(CC) CFLAGS="$(CCFLAGS)" )
- $(LMPG): ;(cd mpeg; make CC=$(CC) CFLAGS="$(CCFLAGS)")
-
- #
- # filter using xstr before built. Slightly smaller executables
- # All files will be prepended xx
- #
- DS=-DBITHELP='"'$(BITHELP)'"' -DCLOCK_MAIL='"'$(CLOCK_MAIL)'"'
- xall: xxobj $(CLOCK_MAIL)
- $(CC) -o $(BIT) $(LDFLAGS) xx*.o $(LIBS)
-
- xxobj: $(CSRC)
- for i in $?; do $(CC) -E $(CFLAGS) -Ijpeg $(DS) $$i | xstr -c -;\
- mv x.c xx$$i; $(CC) -c $(CFLAGS) $(DS) xx$$i; done;
- xstr; mv xs.c xxs.c
- $(CC) -c $(CFLAGS) -Ijpeg $(DS) xxs.c
- date > $@
-
- # Man pages
- man:; tbl bit.1 | nroff -man > bit.m
-
-
- # general dependencies. stuff depends on bit.h
- #
-
- CMNH=bit.h utype.h
- DIS=-DBITHELP='"'$(BITHELP)'"'
-
- jpeg.o : jpeg.c $(CMNH) ; $(CC) $(CFLAGS) -Ijpeg -c jpeg.c
-
- main.o : main.c $(CMNH) global.h
- @echo const char '*' cmpldate = '"'`date '+%m %e %Y %H'`'";' > date.h
- @cat bitmaps/.note >> date.h
- -$(CC) -c $(CFLAGS) $(DIS) main.c
- @/bin/rm date.h
-
- init.o :init.c $(CMNH) extern.h
- $(CC) -c $(CFLAGS) -DCLOCK_MAIL='"'$(CLOCK_MAIL)'"' init.c
-
- coledit.o : coledit.c $(CMNH)
- control.o : control.c $(CMNH)
- crop.o : crop.c $(CMNH)
- cut.o : cut.c $(CMNH)
- display.o : display.c $(CMNH)
- dither.o : dither.c $(CMNH) lookup.h
- extbind.o : extbind.c $(CMNH)
- fio.o : fio.c bit.h
- flist.o : flist.c bit.h
- gif.o : gif.c $(CMNH)
- gl_util.o : gl_util.c gluproto.h
- cursors.o : cursors.c curdef.h
- gui.o : gui.c gui.h utype.h
- holo.o : holo.c $(CMNH)
- iopen.o : iopen.c $(CMNH)
- iprocess.o : iprocess.c $(CMNH)
- medianf.o : medianf.c $(CMNH)
- iris.o : iris.c $(CMNH)
- iutil.o : iutil.c $(CMNH) lookup.h
- marking.o : marking.c $(CMNH) bm.h
- mdbg.o : mdbg.c dmalloc.h
- measure.o : measure.c $(CMNH)
- paint.o : paint.c $(CMNH) paint.h
- pedit.o : pedit.c $(CMNH)
- pnm.o : pnm.c $(CMNH)
- ps.o : ps.c $(CMNH) tsdef.h
- quant.o : quant.c $(CMNH)
- repaint.o : repaint.c $(CMNH)
- scratch.o : scratch.c $(CMNH)
- sunrast.o : sunrast.c $(CMNH)
- text.o : text.c $(CMNH) symbol.h tsdef.h
- tran2d.o : tran2d.c $(CMNH)
- xbm.o : xbm.c $(CMNH)
- zoom.o : zoom.c $(CMNH)
-
-
- #**********************************************************
- # Tags
- #**********************************************************
- tags:$(CSRC) ; ctags $(CSRC) *.h
-
- #**********************************************************
- # LINT
- #**********************************************************
-
- LSYSLIB=-L/usr/lib -lgl_s -lmalloc -lm -lc_s
- LUSERLIB=-L. -lutil -lforms
- LINTLIB=$(LUSERLIB) $(LSYSLIB)
- #LINTFLAG=$(DEFINES) -Ijpeg -Iulib -Iforms/FORMS -u
- LINTFLAG=$(DEFINES) -Ijpeg -Iulib -Iforms/FORMS
- LINTFILE=$(OBJS:.o=.ln)
-
- # rules
- .SUFFIXES: .ln .c
- .c.ln: ; lint -c $(LINTFLAG) $<
-
- bitlint:$(LINTFILE); lint $(LINTFLAG) $(LINTFILE) $(LINTLIB)
-
- #*******************************************************
- # RCS
- # For uniform verion number, -f may be needed in ci
- #*******************************************************
- STATE="Pre-Release"
- #DATE="1993/10/11"
- CIF=-f
- update:$(SRC)
- # rcs -i -azhao -U $?
- ci $(CIF) -u$(VERSION) -s$(STATE) -d$(DATE) $?
- (cd ..; ci $(CIF) -u$(VERSION) -s$(STATE) -d$(DATE) Registration)
- @date > update
-
- OVERSION=0.91
- outdate:
- rcs -o$(OVERSION) $(SRC)
- (cd ..; rcs -o$(OVERSION) Registration)
-
- #******************************************************
- # Make tar
- #******************************************************
- FFILES=README FAQ New src help docs Registration
- TARFLAG=covdf
-
- FTARNAME=bit$(VERSION).tar
- ftar: sfmt veryclean
- -mv RCS ..
- -cd ..; tar $(TARFLAG) $(FTARNAME) $(FFILES); mv RCS src
- #
- # without JPEG
- #
- JFILES=README FAQ src help docs
- JMF=RCS jpeg
- JTARNAME=bit$(VERSION)-jpg.tar
- jtar: sfmt veryclean
- -mv $(JMF) ..
- -cd ..; tar $(TARFLAG) $(JTARNAME) $(JFILES); mv $(JMF) src
-
- # make all tars
- alltar: sfmt veryclean
- -mv RCS ..
- -cd ..; tar $(TARFLAG) $(FTARNAME) $(FFILES); mv RCS src
- -mv $(JMF) ..
- -cd ..; tar $(TARFLAG) $(JTARNAME) $(JFILES); mv $(JMF) src
- #
- # Run bit.1 thru ptroff on NeXt
- psman:; (cd ..;psman)
-
- # Tempory store
- #
- ARCH=../.all.ar
- ar:; @ar ruv $(ARCH) $(SRC)
- getsrc: ; -@ ar x $(ARCH) $(SRC)
- rcp: ; rcp $(ARCH) svec5@menudo:c/sgi
-
- PLIB= -Lulib -lutil -Lforms/FORMS -Ljpeg -ljpeg -limage -lforms -lgl -lfm -lm
- POBJ=profile.o $(OBJ)
- profile: $(POBJ)
- $(CC) -p -o $@ $(POBJ) $(PLIB)
-
- profile.o:profile.c
- $(CC) -Iulib -Iforms/FORMS -O -c $?
- #
- # working format
- #
- refmt:; (for i in $(CSRC) $(HDR); do refmt $$i $$i; done)
- incopyright:; insertcr -v $(CPSRC)
- rmcopyright:; insertcr -rv $(CPSRC);
- prereg:; /bin/rm -f main.o init.o gui.o
-
- #
- # All diffs should be applied after running thru indent
- #
- # Need flag -nfc1 to make header comments correct.
- # Seems not all versions of indent has it ........
- #
- T=-Trgba_t -TIPTR -Tci_t -Tpc_t -TCMPTR -Tbw_t
- CBF=-fca -nfc1 -cdb -sc -i4 -npcs -ss $(T)
- sfmt:; indent $(CBF) $(CSRC) $(HDR)
-
-